<!DOCTYPE html>
<html>
<head>
    <title>重定向响应测试</title>
</head>
<body>
    <h1>重定向响应测试</h1>
    <button onclick="testRedirect()">测试重定向</button>
    <div id="result"></div>

    <script>
        async function testRedirect() {
            try {
                const response = await fetch('/redirect');
                if (response.redirected) {
                    document.getElementById('result').textContent = '重定向到: ' + response.url;
                } else {
                    document.getElementById('result').textContent = '没有重定向';
                }
            } catch (error) {
                document.getElementById('result').textContent = '错误: ' + error.message;
            }
        }
    </script>
</body>
</html> 